package org.come.MountShouHu;

import com.tool.btn.MountShouhuBtn;
import com.tool.role.RoleData;
import com.tool.tcpimg.UIUtils;
import org.come.Frame.MountShouhuJframe;
import org.come.bean.LoginResult;
import org.come.entity.Goodstable;
import org.come.until.Util;

import javax.swing.*;
import java.awt.*;
import java.math.BigDecimal;

import static com.tool.btn.MountShouhuBtn.getGoodType;


public class LvlupJpanel extends JPanel {
private  final ImageIcon icon=new ImageIcon("inkImg/Client/提升守护之力背景.png");
private  final ImageIcon icon1=new ImageIcon("inkImg/background/ss504.png");
private  final ImageIcon icon2=new ImageIcon("inkImg/Client/提升守护之力背景-突破.png");
public MountShouhuBtn tisheng;
public int lvl=0;
public int xiuweidian=4;
public int tishengdianshu=0;
public MountShouhuBtn up;
public MountShouhuBtn down;
public MountShouhuBtn yijiantisheng;
public MountShouhuBtn tishengxiuweidian;
public MountShouhuBtn tupo;
public long dangqianyuanjing=0;
public long suoxuyuanying=0;
public boolean type=true;

	public LvlupJpanel(){
		this.setPreferredSize(new Dimension(339, 375));
		this.setBackground(UIUtils.Color_BACK);
		this.setLayout(null);
		up=new MountShouhuBtn("inkImg/Client/向右箭头11X15.png",1,10,this);
		up.setBounds(262,240,11,15);
		this.add(up);
		down=new MountShouhuBtn("inkImg/Client/向左箭头11X15.png",1,11,this);
		down.setBounds(250,240,11,15);
		this.add(down);
		yijiantisheng=new MountShouhuBtn("inkImg/Client/100X26按钮.png",1,12,"一键提升",UIUtils.Black,UIUtils.TEXT_HY16,this);
		yijiantisheng.setBounds(60,280,100,26);
		this.add(yijiantisheng);
		tishengxiuweidian=new MountShouhuBtn("inkImg/Client/100X26按钮.png",1,13,"提升修为点",UIUtils.Black,UIUtils.TEXT_HY16,this);
		tishengxiuweidian.setBounds(180,280,100,26);
		this.add(tishengxiuweidian);
		tupo=new MountShouhuBtn("inkImg/Client/60X26按钮.png",1,14,"突破",UIUtils.Black,UIUtils.TEXT_HY16,this);
		tupo.setBounds(160,280,60,26);
		tupo.setVisible(false);
		this.add(tupo);
		
	}

@Override
protected void paintComponent(Graphics g) {
	super.paintComponent(g);
	if (type){
		if (icon.getImage()!=null){
			g.drawImage(icon.getImage(),0,0,339,375,null);
		}
		final LoginResult login = RoleData.getRoleData().getLoginResult();
		Util.drawPrice(g, login.getGold(), 140, 220);
		long n= 10000000L *(tishengdianshu==0?1:tishengdianshu);
		Util.drawPrice(g, new BigDecimal(n), 140, 190);
		//0中天 1青龙 2白虎 3玄武 4朱雀
		g.setColor(Color.white);
		g.drawString(tishengdianshu+"",190,252);
		yijiantisheng.setVisible(true);
		tishengxiuweidian.setVisible(true);
		tupo.setVisible(false);
	}else {
		if (icon2.getImage()!=null){
			g.drawImage(icon2.getImage(),0,0,339,375,null);
		}
		yijiantisheng.setVisible(false);
		tishengxiuweidian.setVisible(false);
		tupo.setVisible(true);
		Goodstable ltrGoods = getGoodType(2258);
		dangqianyuanjing= ltrGoods == null ? 0 : ltrGoods.getUsetime();
		g.setColor(Color.white);
		suoxuyuanying=(lvl+1)*12;
		g.drawString(suoxuyuanying+"",180,190);
		g.drawString(dangqianyuanjing+"",180,220);
	}
	g.setColor(Color.white);
	if (MountShouhuJframe.getMountShouhuJframe().getMountShouhuJpanel().getXuanzhong()==0){
		g.drawString("中天",180,type?60:58);
		lvl=MountShouhuJframe.getMountShouhuJframe().getMountShouhuJpanel().shouHu.zhongtianlvl==-1?0:MountShouhuJframe.getMountShouhuJframe().getMountShouhuJpanel().shouHu.zhongtianlvl;
		xiuweidian=MountShouhuJframe.getMountShouhuJframe().getMountShouhuJpanel().shouHu.zhongtianxiuweidian==-1?0:MountShouhuJframe.getMountShouhuJframe().getMountShouhuJpanel().shouHu.zhongtianxiuweidian;
	}else if (MountShouhuJframe.getMountShouhuJframe().getMountShouhuJpanel().getXuanzhong()==1){
		g.drawString("青龙",180,type?60:58);
		lvl=MountShouhuJframe.getMountShouhuJframe().getMountShouhuJpanel().shouHu.qinglonglvl==-1?0:MountShouhuJframe.getMountShouhuJframe().getMountShouhuJpanel().shouHu.qinglonglvl;
		xiuweidian=MountShouhuJframe.getMountShouhuJframe().getMountShouhuJpanel().shouHu.qinglongxiuweidian==-1?0:MountShouhuJframe.getMountShouhuJframe().getMountShouhuJpanel().shouHu.qinglongxiuweidian;
	}else if (MountShouhuJframe.getMountShouhuJframe().getMountShouhuJpanel().getXuanzhong()==2){
		g.drawString("白虎",180,type?60:58);
		lvl=MountShouhuJframe.getMountShouhuJframe().getMountShouhuJpanel().shouHu.baihulvl==-1?0:MountShouhuJframe.getMountShouhuJframe().getMountShouhuJpanel().shouHu.baihulvl;
		xiuweidian=MountShouhuJframe.getMountShouhuJframe().getMountShouhuJpanel().shouHu.baihuxiuweidian==-1?0:MountShouhuJframe.getMountShouhuJframe().getMountShouhuJpanel().shouHu.baihuxiuweidian;
	}else if (MountShouhuJframe.getMountShouhuJframe().getMountShouhuJpanel().getXuanzhong()==3){
		g.drawString("玄武",180,type?60:58);
		lvl=MountShouhuJframe.getMountShouhuJframe().getMountShouhuJpanel().shouHu.xuanwulvl==-1?0:MountShouhuJframe.getMountShouhuJframe().getMountShouhuJpanel().shouHu.xuanwulvl;
		xiuweidian=MountShouhuJframe.getMountShouhuJframe().getMountShouhuJpanel().shouHu.xuanwuxiuweidian==-1?0:MountShouhuJframe.getMountShouhuJframe().getMountShouhuJpanel().shouHu.xuanwuxiuweidian;
	}else if (MountShouhuJframe.getMountShouhuJframe().getMountShouhuJpanel().getXuanzhong()==4){
		g.drawString("朱雀",180,type?60:58);
		lvl=MountShouhuJframe.getMountShouhuJframe().getMountShouhuJpanel().shouHu.zhuquelvl==-1?0:MountShouhuJframe.getMountShouhuJframe().getMountShouhuJpanel().shouHu.zhuquelvl;
		xiuweidian=MountShouhuJframe.getMountShouhuJframe().getMountShouhuJpanel().shouHu.zhuquexiuweidian==-1?0:MountShouhuJframe.getMountShouhuJframe().getMountShouhuJpanel().shouHu.zhuquexiuweidian;
	}
	g.drawString(lvl+"",190,85);
	double b=xiuweidian/((lvl+1)*6.0);
	g.drawImage(icon1.getImage(),139,97, (int) (130*b),17,null);
	g.drawString(xiuweidian+"/"+(lvl+1)*6,190,110);
	
	

}

public MountShouhuBtn getTisheng() {
	return tisheng;
}

public void setTisheng(MountShouhuBtn tisheng) {
	this.tisheng = tisheng;
}

public int getLvl() {
	return lvl;
}

public void setLvl(int lvl) {
	this.lvl = lvl;
}

public int getXiuweidian() {
	return xiuweidian;
}

public void setXiuweidian(int xiuweidian) {
	this.xiuweidian = xiuweidian;
}

public int getTishengdianshu() {
	return tishengdianshu;
}

public void setTishengdianshu(int tishengdianshu) {
	this.tishengdianshu = tishengdianshu;
}

public MountShouhuBtn getUp() {
	return up;
}

public void setUp(MountShouhuBtn up) {
	this.up = up;
}

public MountShouhuBtn getDown() {
	return down;
}

public void setDown(MountShouhuBtn down) {
	this.down = down;
}

public MountShouhuBtn getYijiantisheng() {
	return yijiantisheng;
}

public void setYijiantisheng(MountShouhuBtn yijiantisheng) {
	this.yijiantisheng = yijiantisheng;
}

public MountShouhuBtn getTishengxiuweidian() {
	return tishengxiuweidian;
}

public void setTishengxiuweidian(MountShouhuBtn tishengxiuweidian) {
	this.tishengxiuweidian = tishengxiuweidian;
}

public MountShouhuBtn getTupo() {
	return tupo;
}

public void setTupo(MountShouhuBtn tupo) {
	this.tupo = tupo;
}

public long getDangqianyuanjing() {
	return dangqianyuanjing;
}

public void setDangqianyuanjing(int dangqianyuanjing) {
	this.dangqianyuanjing = dangqianyuanjing;
}

public long getSuoxuyuanying() {
	return suoxuyuanying;
}

public void setSuoxuyuanying(int suoxuyuanying) {
	this.suoxuyuanying = suoxuyuanying;
}

public boolean isType() {
	return type;
}

public void setType(boolean type) {
	this.type = type;
}
}
